The segmented memory management system is one of the memory management systems for an information processing device. In the segmented memory management system, a program in a virtual address space is managed in units of segments of variable length.
In an information processing device adopting the segmented memory management system, when the virtual address space is generated, segment descriptors containing a base address field and a segment size field for the segment are stored in a segment table.
FIG. 10 shows an example of the segment table. A start address in the virtual address space of each segment is stored in the base address field. Further, the size of the segment is stored in the segment size field.
Further, in a method in which a virtual address to be referred to is specified by using a base address such as a base address specification method, an index address specification method, or the like, a base address register number and a relative address are stored in an operand field of an instruction. The base address is acquired from a base address register having the base address register number, the base address and the relative address are added, and whereby an effective address can be calculated.
On the other hand, referable segments are specified in a process to be executed. In an information processing device, when the effective address to be referred to is outside the range of the segment that can be referred to, it is determined as “out-of-range reference exception” and an exception processing is executed to the out-of-range reference exception.
As a method for detecting an out-of-range reference, for example, there is a method described in Patent literature 1 in which a segment size corresponding to the segment to be referred to is acquired by searching the segment table and it is determined whether or not the relative address of the effective address is smaller than the segment size.
[Patent literature 1] Japanese Patent Application Laid-Open No. 1985-114948
However, in the method described in Patent literature 1, first, it is necessary to identify a segment number of the segment to be referred to in order to acquire the segment size corresponding to the segment to be referred to from the segment table. Because the segment number is included in a part of the base address, the segment number can be identified by reading the base address from the base address register corresponding to the base address register number included in the operand field of the instruction. By searching a base address field of the segment table by using the segment number as a key, the segment size corresponding to the segment to be referred can be acquired.
Thus, in order to acquire the segment size corresponding to the segment to be referred to from the segment table, first, the base address register is read, the segment number is identified and further, it is necessary to search the segment table. Therefore, it takes a long time to acquire the segment size.
Further, in the method in which the segment table is searched, when the segment table is complicated, it may take a long time to search the segment table.
When one segment table is used, the segment table is searched by using the segment number of the base address register as the key, as shown in FIG. 11. In contrast, for example, when a multi-process is performed, as shown in FIG. 12, the segment table may be provided for each process because each process has an independent virtual address space. In such a case, it is necessary to identify the segment table of the process on the basis of the process number and then, to acquire the segment size corresponding to the segment number.
Further, when there are many segments, a field of the segment number is divided into some groups and multiple tables may be configured, as shown in FIG. 13. When such configuration is used, a case in which a plurality of segment tables have to be searched may occur. In an example shown in FIG. 13, the field of the segment number is divided into two groups: UPPER and LOWER, and the segment table is provided for only the UPPER group. In this example, it is necessary to identify the segment table corresponding to a segment number UPPER and then, to acquire the segment size corresponding to a segment number LOWER.
In many cases, the segment table is stored in the memory. Accordingly, when the table is complicated, the number of times of accessing to the memory increases and it takes a further long time to search the segment table.